home *** CD-ROM | disk | FTP | other *** search
- global shipData, shipSO, maxShips, bulletData, bulletSO, maxBullets, playerViewPoint, inputString
-
- on initializeShips
- shipData = []
- repeat with wShip = 1 to maxShips
- wSprite = shipSO + wShip
- puppetSprite(wSprite, 1)
- set the ink of sprite wSprite to 32
- set the member of sprite wSprite to "Red Ship"
- set the loc of sprite wSprite to point(-50, 100)
- add(shipData, [0, 1, 1, [point(0, 0), point(0, 0), 0, 0], [0, 0, 0, 0]])
- end repeat
- end
-
- on initializeBullets
- bulletData = []
- repeat with wBullet = 1 to maxBullets
- wSprite = bulletSO + wBullet
- puppetSprite(wSprite, 1)
- set the ink of sprite wSprite to 32
- set the member of sprite wSprite to "Medium Cannon 1"
- sprite(wSprite).locZ = 1000
- set the loc of sprite wSprite to point(-50, 0)
- add(bulletData, [0, 0, 0])
- end repeat
- end
-
- on initializeBulletReferenceIndex
- global bulletReferenceIndex
- bulletReferenceIndex = []
- sequenceList = ["Light Cannon 1", "Light Cannon 2"]
- particleProfile = [1, 0, 0]
- launchSoundprofile = ["Normal Gun Round Two SFX"]
- add(bulletReferenceIndex, [sequenceList, 20, 100, 5, particleProfile, 0, 6, launchSoundprofile])
- sequenceList = ["Medium Cannon 1", "Medium Cannon 2"]
- particleProfile = [2, 0, 0]
- launchSoundprofile = ["laser Round One SFX"]
- add(bulletReferenceIndex, [sequenceList, 35, 125, 9, particleProfile, 0, 10, launchSoundprofile])
- sequenceList = ["Heavy Cannon 1", "Heavy Cannon 2"]
- particleProfile = [3, 0, 0]
- launchSoundprofile = ["Normal Gun Round One SFX"]
- add(bulletReferenceIndex, [sequenceList, 25, 125, 10, particleProfile, 0, 12, launchSoundprofile])
- sequenceList = ["Torpedo 1", "Torpedo 2"]
- particleProfile = [8, 14, 6]
- launchSoundprofile = ["Missile SFX"]
- add(bulletReferenceIndex, [sequenceList, 140, 50, 10, particleProfile, 1, 35, launchSoundprofile])
- sequenceList = ["Drone 1", "Drone 2", "Drone 3", "Drone 4", "Drone 5"]
- particleProfile = [3, 6, 8]
- launchSoundprofile = ["Laser Round Two SFX"]
- add(bulletReferenceIndex, [sequenceList, 100, 40, 10, particleProfile, 1, 10, launchSoundprofile])
- sequenceList = ["Dark Missile 1", "Dark Missile 2"]
- particleProfile = [3, 13, 6]
- launchSoundprofile = ["Missile SFX"]
- add(bulletReferenceIndex, [sequenceList, 80, 45, 10, particleProfile, 1, 15, launchSoundprofile])
- sequenceList = ["Torpedo 1", "Torpedo 2"]
- particleProfile = [5, 12, 1]
- launchSoundprofile = ["Mega Cannon SFX"]
- add(bulletReferenceIndex, [sequenceList, 800, 250, 10, particleProfile, 2, 1000, launchSoundprofile])
- sequenceList = ["Rocket 1", "Rocket 2"]
- particleProfile = [8, 1, 1]
- launchSoundprofile = ["Rocket SFX"]
- add(bulletReferenceIndex, [sequenceList, 80, 125, 10, particleProfile, 0, 60, launchSoundprofile])
- sequenceList = ["Rocket 1", "Rocket 2"]
- particleProfile = [8, 6, 2]
- launchSoundprofile = ["Missile SFX"]
- add(bulletReferenceIndex, [sequenceList, 80, 125, 10, particleProfile, 1, 30, launchSoundprofile])
- sequenceList = ["Laser Dot"]
- particleProfile = [11, 0, 0]
- launchSoundprofile = ["Mega Cannon SFX"]
- add(bulletReferenceIndex, [sequenceList, 10, 200, 10, particleProfile, 0, 5, launchSoundprofile])
- end
-
- on addBullet bOwner, bType, bLoc, bMomentum, bAim, btarget
- global bulletReferenceIndex
- validSlot = 0
- repeat with wScan = 1 to count(bulletData)
- if (bulletData[wScan][1] = 0) and (validSlot = 0) then
- validSlot = wScan
- end if
- end repeat
- if validSlot <> 0 then
- wSprite = bulletSO + validSlot
- bDuration = bulletReferenceIndex[bType][2]
- bSpeed = bulletReferenceIndex[bType][3]
- bSounds = bulletReferenceIndex[bType][8]
- bulletData[validSlot] = [1, bType, bOwner, [bLoc, bMomentum, bAim, bSpeed], [bDuration, btarget]]
- playSound(bSounds[1])
- set the member of sprite wSprite to bulletReferenceIndex[bType][1][1]
- sprite(wSprite).rotation = bAim
- end if
- end
-
- on initializeShipReferenceIndex
- global shipReferenceIndex
- shipReferenceIndex = []
- schematicsBit = [150, 80, 0, 250, 0]
- engineeringBit = [6, 3, 5, 2, 60]
- mainWeaponsData = [1, 50, 4, 2000]
- parametersBit = [100, 2000, 2, 100, 3500]
- repairBayBit = [20, 0, 0, 0]
- add(shipReferenceIndex, ["Fighter", schematicsBit, engineeringBit, mainWeaponsData, parametersBit, repairBayBit])
- schematicsBit = [150, 80, 0, 250, 0]
- engineeringBit = [6, 3, 4, 2, 60]
- mainWeaponsData = [3, 50, 30, 3000]
- parametersBit = [180, 2400, 1, 110, 4500]
- repairBayBit = [30, 0, 0, 0]
- add(shipReferenceIndex, ["GunBoat", schematicsBit, engineeringBit, mainWeaponsData, parametersBit, repairBayBit])
- schematicsBit = [150, 80, 0, 250, 0]
- engineeringBit = [6, 3, 6, 2, 60]
- mainWeaponsData = [2, 50, 20, 4000]
- parametersBit = [60, 1800, 3, 90, 4000]
- repairBayBit = [15, 0, 0, 0]
- add(shipReferenceIndex, ["Stealther", schematicsBit, engineeringBit, mainWeaponsData, parametersBit, repairBayBit])
- schematicsBit = [150, 80, 0, 350, 0]
- engineeringBit = [6, 3, 4, 1, 60]
- mainWeaponsData = [3, 50, 18, 3000]
- parametersBit = [250, 1000, 1, 250, 2000]
- repairBayBit = [30, 0, 0, 0]
- add(shipReferenceIndex, ["Destroyer", schematicsBit, engineeringBit, mainWeaponsData, parametersBit, repairBayBit])
- schematicsBit = [150, 80, 0, 300, 0]
- engineeringBit = [6, 3, 4, 1, 60]
- mainWeaponsData = [2, 50, 4, 4000]
- parametersBit = [300, 1000, 1, 350, 2500]
- repairBayBit = [30, 0, 0, 0]
- add(shipReferenceIndex, ["Cruiser", schematicsBit, engineeringBit, mainWeaponsData, parametersBit, repairBayBit])
- schematicsBit = [175, 80, 1, 350, 0]
- engineeringBit = [6, 6, 0, 0, 0]
- mainWeaponsData = [4, 50, 180, 8000]
- parametersBit = [400, 4000, 1, 500, 5000]
- repairBayBit = [15, 1, 1, 1]
- add(shipReferenceIndex, ["Home Base", schematicsBit, engineeringBit, mainWeaponsData, parametersBit, repairBayBit])
- schematicsBit = [250, 80, 1, 350, 250]
- engineeringBit = [6, 3, 2, 1, 0]
- mainWeaponsData = [5, 50, 100, 3500]
- parametersBit = [600, 1000, 1, 500, 15000]
- repairBayBit = [10, 0, 0, 0]
- add(shipReferenceIndex, ["Saucer 1", schematicsBit, engineeringBit, mainWeaponsData, parametersBit, repairBayBit])
- schematicsBit = [150, 80, 1, 250, 100]
- engineeringBit = [6, 3, 4, 1, 20]
- mainWeaponsData = [6, 50, 120, 8000]
- parametersBit = [350, 6000, 1, 500, 2000]
- repairBayBit = [40, 0, 0, 0]
- add(shipReferenceIndex, ["Saucer 2", schematicsBit, engineeringBit, mainWeaponsData, parametersBit, repairBayBit])
- schematicsBit = [125, 80, 1, 250, 75]
- engineeringBit = [6, 3, 4, 1, 40]
- mainWeaponsData = [1, 50, 15, 1800]
- parametersBit = [100, 1800, 1, 500, 2000]
- repairBayBit = [40, 0, 0, 0]
- add(shipReferenceIndex, ["Saucer 3", schematicsBit, engineeringBit, mainWeaponsData, parametersBit, repairBayBit])
- schematicsBit = [100, 80, 1, 250, 50]
- engineeringBit = [6, 3, 4, 1, 60]
- mainWeaponsData = [3, 50, 40, 3000]
- parametersBit = [80, 3000, 1, 500, 4000]
- repairBayBit = [40, 0, 0, 0]
- add(shipReferenceIndex, ["Saucer 4", schematicsBit, engineeringBit, mainWeaponsData, parametersBit, repairBayBit])
- schematicsBit = [75, 80, 1, 225, 20]
- engineeringBit = [6, 3, 4, 1, 50]
- mainWeaponsData = [2, 50, 30, 2500]
- parametersBit = [40, 2500, 1, 500, 3000]
- repairBayBit = [40, 0, 0, 0]
- add(shipReferenceIndex, ["Saucer 5", schematicsBit, engineeringBit, mainWeaponsData, parametersBit, repairBayBit])
- schematicsBit = [40, 80, 1, 200, 10]
- engineeringBit = [6, 3, 4, 3, 65]
- mainWeaponsData = [1, 50, 35, 2000]
- parametersBit = [20, 2000, 1, 500, 2500]
- repairBayBit = [40, 0, 0, 0]
- add(shipReferenceIndex, ["Saucer 6", schematicsBit, engineeringBit, mainWeaponsData, parametersBit, repairBayBit])
- end
-
- on addShip sOwner, sType, sLoc, sMomentum, sAim, slaveState
- global shipReferenceIndex, mostRecentMaster
- validSlot = 0
- repeat with wScan = 1 to count(shipData)
- if (shipData[wScan][1] = 0) and (validSlot = 0) then
- validSlot = wScan
- end if
- end repeat
- if validSlot <> 0 then
- if slaveState = 0 then
- mostRecentMaster = validSlot
- sMaster = 0
- else
- sMaster = mostRecentMaster
- end if
- wSprite = shipSO + validSlot
- killingTarget = 0
- repairStatus = [0, 0]
- shipData[validSlot] = [1, sType, sOwner, [sLoc, sMomentum, sAim, 0], [0, 0, 0, 0, 0], sMaster, killingTarget, repairStatus]
- memName = shipReferenceIndex[sType][1]
- set the member of sprite wSprite to memName
- sprite(wSprite).rotation = sAim
- end if
- end
-
- on moveBulletData
- global bulletReferenceIndex, bulletSequenceTimer, shipReferenceIndex, specialPlayerStats, launchShrike, shrikeDestination
- bulletSequenceTimer = bulletSequenceTimer + 1
- repeat with wScan = 1 to count(bulletData)
- if bulletData[wScan][1] = 1 then
- wSprite = bulletSO + wScan
- bulletDataBit_Loc = bulletData[wScan][4]
- bulletDataBit_Status = bulletData[wScan][5]
- if bulletDataBit_Status[1] <= 0 then
- set the loc of sprite wSprite to point(-50, -50)
- bulletData[wScan][1] = 0
- next repeat
- end if
- bSpeed = bulletReferenceIndex[bulletData[wScan][2]][3]
- hitsAllHostile = 0
- myTarget = bulletData[wScan][5][2]
- homingState = bulletReferenceIndex[bulletData[wScan][2]][6]
- if (myTarget <> 0) and (homingState = 1) then
- bAim = findAngle(bulletDataBit_Loc[1], shipData[myTarget][4][1])
- sprite(wSprite).rotation = bAim
- else
- if (myTarget <> 0) and (homingState = 2) then
- bAim = findAngle(bulletDataBit_Loc[1], myTarget)
- sprite(wSprite).rotation = bAim
- else
- hitsAllHostile = 1
- bAim = bulletDataBit_Loc[3]
- end if
- end if
- locY = integer(cos(bAim * PI / 180) * -bSpeed)
- locX = integer(sin(bAim * PI / 180) * bSpeed)
- bulletDataBit_Loc[1] = bulletDataBit_Loc[1] + bulletDataBit_Loc[2] + point(locX, locY)
- bulletDataBit_Status[1] = bulletDataBit_Status[1] - 1
- termination = 0
- selfGov = bulletData[wScan][3]
- targetHit = 0
- if (homingState = 1) and (myTarget <> 0) then
- targRadius = shipReferenceIndex[shipData[myTarget][3]][2][1]
- shipLoc = shipData[myTarget][4][1]
- bulletLoc = bulletDataBit_Loc[1]
- if findDistance(shipLoc, bulletLoc) <= (50 + targRadius) then
- termination = 1
- targetHit = myTarget
- end if
- else
- if (homingState = 2) and (myTarget <> 0) then
- shipLoc = myTarget
- bulletLoc = bulletDataBit_Loc[1]
- if findDistance(shipLoc, bulletLoc) <= (250 + targRadius) then
- dealBlast(bulletLoc, 500, 1000)
- termination = 1
- targetHit = 0
- end if
- specialPlayerStats[5] = 1000
- else
- repeat with wShipScan = 1 to count(shipData)
- if shipData[wShipScan][1] = 1 then
- if selfGov <> shipData[wShipScan][3] then
- targRadius = shipReferenceIndex[shipData[wShipScan][2]][2][1]
- shipLoc = shipData[wShipScan][4][1]
- bulletLoc = bulletDataBit_Loc[1]
- if findDistance(shipLoc, bulletLoc) <= (150 + targRadius) then
- termination = 1
- targetHit = wShipScan
- end if
- end if
- end if
- end repeat
- end if
- end if
- bType = bulletData[wScan][2]
- particleProfile = bulletReferenceIndex[bType][5]
- if termination = 0 then
- sequenceList = bulletReferenceIndex[bType][1]
- if particleProfile[2] <> 0 then
- if ((wScan + bulletSequenceTimer) mod particleProfile[3]) = 0 then
- addparticle(particleProfile[2], bulletDataBit_Loc[1] - bulletDataBit_Loc[2], bulletDataBit_Loc[2])
- end if
- end if
- if bType = 7 then
- specialPlayerStats[5] = 1000
- end if
- set the member of sprite wSprite to sequenceList[(bulletSequenceTimer mod count(sequenceList)) + 1]
- set the loc of sprite wSprite to (bulletDataBit_Loc[1] - playerViewPoint) / 10
- sprite(wSprite).visible = 1
- next repeat
- end if
- if bType = 10 then
- if specialPlayerStats[5] = 0 then
- launchShrike = 1
- shrikeDestination = bulletDataBit_Loc[1]
- end if
- end if
- if bType = 7 then
- specialPlayerStats[5] = 1000
- member("Mega Cannon Status").text = "Reloading"
- else
- params = shipData[targetHit][5]
- if targetHit = 1 then
- params[1] = params[1] + integer(bulletReferenceIndex[bType][7] / 2)
- else
- params[1] = params[1] + bulletReferenceIndex[bType][7]
- end if
- addparticle(particleProfile[1], bulletDataBit_Loc[1], bulletDataBit_Loc[2])
- if targetHit = 1 then
- playSound("player Is Hit SFX")
- end if
- end if
- set the loc of sprite wSprite to point(-50, -50)
- bulletData[wScan][1] = 0
- end if
- end repeat
- end
-
- on dealBlast blastloc, blastRadius, blastDamage
- global shipData, shipReferenceIndex
- rRing = random(360) / 6
- repeat with wRepairSpark = 1 to 6
- rWidth = 100
- shipAim = (360 / 6 * wRepairSpark) + rRing
- locY2 = integer(cos(shipAim * PI / 180) * -rWidth)
- locX2 = integer(sin(shipAim * PI / 180) * rWidth)
- addparticle(9, blastloc + point(locX2, locY2), point(locX2, locY2) / 5)
- end repeat
- totalShipsToasted = 0
- repeat with wShipScan = 1 to count(shipData)
- if shipData[wShipScan][1] = 1 then
- targRadius = shipReferenceIndex[shipData[wShipScan][3]][2][1]
- shipLoc = shipData[wShipScan][4][1]
- bulletLoc = blastloc
- if findDistance(shipLoc, blastloc) <= (blastRadius + targRadius) then
- shipData[wShipScan][5][1] = shipData[wShipScan][5][1] + blastDamage
- totalShipsToasted = totalShipsToasted + 1
- end if
- end if
- end repeat
- end
-
- on moveShips
- global shipReferenceIndex, levelScore, totalActiveShips, totalrangedShips, totalShipsRecord, totalEnemyShips, searchAItimer, hitFirstTime, playerSelectedWeapon, launchShrike, shrikeDestination, specialPlayerStats
- harvestInput()
- totalActiveShips = 0
- totalrangedShips = 0
- totalEnemyShips = 0
- activeList = []
- centerLoc = shipData[1][4][1]
- shipAim = shipData[1][4][3]
- formationControlPoints = []
- repeat with wPoint = 1 to 50
- locY = integer(cos((shipAim + 120) * PI / 180) * -(wPoint * 300))
- locX = integer(sin((shipAim + 120) * PI / 180) * (wPoint * 300))
- add(formationControlPoints, shipData[1][4][1] + point(locX, locY))
- locY = integer(cos((shipAim - 120) * PI / 180) * -(wPoint * 300))
- locX = integer(sin((shipAim - 120) * PI / 180) * (wPoint * 300))
- add(formationControlPoints, centerLoc + point(locX, locY))
- end repeat
- totalForms = 0
- searchAItimer = searchAItimer + 1
- if searchAItimer > count(shipData) then
- searchAItimer = 1
- end if
- repeat with wShip = 1 to count(shipData)
- if shipData[wShip][1] = 1 then
- totalActiveShips = totalActiveShips + 1
- activeShipType = shipData[wShip][2]
- shipDataBit_Loc = shipData[wShip][4]
- shipDataBit_Status = shipData[wShip][5]
- if shipData[wShip][3] = 2 then
- totalEnemyShips = totalEnemyShips + 1
- end if
- if findDistance(shipDataBit_Loc[1], playerViewPoint) <= 100000 then
- add(activeList, 1)
- totalrangedShips = totalrangedShips + 1
- shipParameters = shipData[wShip][5]
- weaponRef = shipReferenceIndex[shipData[wShip][2]][4]
- paramsRef = shipReferenceIndex[shipData[wShip][2]][5]
- wSprite = shipSO + wShip
- engineeringBit = shipReferenceIndex[activeShipType][3]
- maxSpinSpeed = engineeringBit[1]
- spinSpeed = engineeringBit[2]
- shipAccelRate = engineeringBit[3]
- shipDecelRate = engineeringBit[4]
- shipTerminalVelocity = engineeringBit[5]
- repairBayBit = shipReferenceIndex[activeShipType][6]
- if wShip = 1 then
- literalInputString = inputString
- else
- literalInputString = [0, 0, 0, 0, 0, 0, 0, 0]
- masterShipID = shipData[wShip][6]
- AI_Objective = #HangOut
- if masterShipID <> 0 then
- distanceFromMaster = findDistance(shipData[wShip][4][1], shipData[masterShipID][4][1])
- if distanceFromMaster > 1000 then
- AI_Objective = #FindMaster
- else
- AI_Objective = #SeekFormation
- end if
- end if
- killingTarget = shipData[wShip][7]
- if killingTarget = 0 then
- aquireNewTarget = 1
- else
- if shipData[killingTarget][1] = 0 then
- shipData[wShip][7] = 0
- aquireNewTarget = 1
- end if
- end if
- if searchAItimer = wShip then
- aquireNewTarget = 1
- end if
- if aquireNewTarget = 1 then
- selfGovernment = shipData[wShip][3]
- testRange = paramsRef[5]
- testUnit = 0
- repeat with wScanner = 1 to count(shipData)
- if shipData[wScanner][1] = 1 then
- targetGovernment = shipData[wScanner][3]
- if selfGovernment <> targetGovernment then
- scannerRange = findDistance(shipData[wScanner][4][1], shipData[wShip][4][1])
- if scannerRange < testRange then
- testRange = scannerRange
- testUnit = wScanner
- end if
- end if
- end if
- end repeat
- shipData[wShip][7] = testUnit
- else
- testUnit = shipData[wShip][7]
- testRange = findDistance(shipData[testUnit][4][1], shipData[wShip][4][1])
- end if
- if testUnit <> 0 then
- if testRange > weaponRef[4] then
- AI_Objective = #FindEnemy
- killingTarget = shipData[wShip][7]
- else
- AI_Objective = #AttackEnemy
- killingTarget = shipData[wShip][7]
- end if
- end if
- case AI_Objective of
- #HangOut:
- literalInputString[3] = 1
- #FindMaster:
- targetVector = findAngle(shipData[masterShipID][4][1], shipData[wShip][4][1]) mod 360
- selfVector = shipData[wShip][4][3] mod 360
- maxVector = spinSpeed
- realVector = targetVector - selfVector
- maxX = integer(sin(maxVector * PI / 180) * 100)
- locX = integer(sin(realVector * PI / 180) * 100)
- if (locX < abs(maxX)) and (locX > (0 - abs(maxX))) then
- shipData[wShip][4][3] = targetVector + 180
- else
- if locX > 0 then
- literalInputString[1] = 1
- else
- literalInputString[2] = 1
- end if
- end if
- literalInputString[4] = 1
- #SeekFormation:
- literalInputString[3] = 1
- #FindEnemy:
- targetVector = findAngle(shipData[killingTarget][4][1], shipData[wShip][4][1]) mod 360
- selfVector = shipData[wShip][4][3] mod 360
- maxVector = spinSpeed
- realVector = targetVector - selfVector
- maxX = integer(sin(maxVector * PI / 180) * 100)
- locX = integer(sin(realVector * PI / 180) * 100)
- if (locX < abs(maxX)) and (locX > (0 - abs(maxX))) then
- shipData[wShip][4][3] = targetVector + 180
- else
- if locX > 0 then
- literalInputString[1] = 1
- else
- literalInputString[2] = 1
- end if
- end if
- literalInputString[4] = 1
- #AttackEnemy:
- targetVector = findAngle(shipData[killingTarget][4][1], shipData[wShip][4][1]) mod 360
- selfVector = shipData[wShip][4][3] mod 360
- maxVector = spinSpeed
- realVector = targetVector - selfVector
- maxX = integer(sin(maxVector * PI / 180) * 100)
- locX = integer(sin(realVector * PI / 180) * 100)
- if (locX < abs(maxX)) and (locX > (0 - abs(maxX))) then
- shipData[wShip][4][3] = targetVector + 180
- else
- if locX > 0 then
- literalInputString[1] = 1
- else
- literalInputString[2] = 1
- end if
- end if
- literalInputString[3] = 1
- literalInputString[5] = 1
- end case
- end if
- shipIsdead = 0
- if wShip = 1 then
- shieldBonus = specialPlayerStats[1]
- else
- shieldBonus = 0
- end if
- if shipParameters[1] >= (paramsRef[1] + shieldBonus) then
- shipIsdead = 1
- end if
- if shipIsdead = 1 then
- literalInputString = [0, 0, 1, 0, 0, 0, 0, 0]
- end if
- if literalInputString[1] = 1 then
- shipDataBit_Loc[4] = shipDataBit_Loc[4] - spinSpeed
- if shipDataBit_Loc[4] < (0 - maxSpinSpeed) then
- shipDataBit_Loc[4] = 0 - maxSpinSpeed
- end if
- else
- if literalInputString[2] = 1 then
- shipDataBit_Loc[4] = shipDataBit_Loc[4] + spinSpeed
- if shipDataBit_Loc[4] > maxSpinSpeed then
- shipDataBit_Loc[4] = maxSpinSpeed
- end if
- else
- repeat with wRep = 1 to spinSpeed
- if shipDataBit_Loc[4] > 0 then
- shipDataBit_Loc[4] = shipDataBit_Loc[4] - 1
- next repeat
- end if
- if shipDataBit_Loc[4] < 0 then
- shipDataBit_Loc[4] = shipDataBit_Loc[4] + 1
- end if
- end repeat
- end if
- end if
- if literalInputString[4] = 1 then
- shipAim = shipDataBit_Loc[3]
- locY = integer(cos(shipAim * PI / 180) * -shipAccelRate)
- locX = integer(sin(shipAim * PI / 180) * shipAccelRate)
- shipDataBit_Loc[2] = shipDataBit_Loc[2] + point(locX, locY)
- shipAim = shipDataBit_Loc[3]
- locY1 = integer(cos(shipAim * PI / 180) * -120)
- locX1 = integer(sin(shipAim * PI / 180) * 120)
- rWidth = random(100) - 50
- shipAim = shipDataBit_Loc[3]
- locY2 = integer(cos((shipAim + 90) * PI / 180) * -rWidth)
- locX2 = integer(sin((shipAim + 90) * PI / 180) * rWidth)
- else
- if literalInputString[3] = 1 then
- shipAim = findAngle(shipDataBit_Loc[2], point(0, 0))
- shipSlowDist = findDistance(shipDataBit_Loc[2], point(0, 0))
- if shipSlowDist > shipDecelRate then
- locY = integer(cos(shipAim * PI / 180) * -shipDecelRate)
- locX = integer(sin(shipAim * PI / 180) * shipDecelRate)
- shipDataBit_Loc[2] = shipDataBit_Loc[2] + point(locX, locY)
- else
- shipDataBit_Loc[2] = point(0, 0)
- end if
- end if
- end if
- canRepairNow = 0
- if shipDataBit_Loc[2] = point(0, 0) then
- if shipData[wShip][8][1] > 0 then
- shipData[wShip][8][1] = shipData[wShip][8][1] - 1
- else
- shipData[wShip][8][1] = repairBayBit[1]
- if repairBayBit[3] = 1 then
- canRepairNow = 1
- end if
- end if
- else
- shipData[wShip][8][1] = 60
- end if
- if canRepairNow = 1 then
- repairID = 0
- damageReport = 0
- selfGovernment = shipData[wShip][3]
- testRange = 1500
- testUnit = 0
- repeat with repairScanner = 1 to count(shipData)
- if shipData[repairScanner][1] = 1 then
- if repairScanner <> wShip then
- targetGovernment = shipData[repairScanner][3]
- if selfGovernment = targetGovernment then
- if shipData[repairScanner][4][2] = point(0, 0) then
- if shipData[repairScanner][5][1] > 0 then
- scannerRange = findDistance(shipData[repairScanner][4][1], shipData[wShip][4][1])
- if scannerRange < testRange then
- testRange = scannerRange
- testUnit = repairScanner
- end if
- end if
- end if
- end if
- end if
- end if
- end repeat
- if testUnit <> 0 then
- addparticle(16, shipData[testUnit][4][1], shipDataBit_Loc[2])
- repeat with wRepair = 1 to 5
- if shipData[testUnit][5][1] > 0 then
- shipData[testUnit][5][1] = shipData[testUnit][5][1] - 1
- shipData[wShip][5][2] = shipData[wShip][5][2] + 1
- end if
- end repeat
- if testUnit = 1 then
- playSound("powerup SFX")
- end if
- end if
- end if
- if wShip = 1 then
- validWeaps = [1, 0, 0, 0, 0]
- if specialPlayerStats[2] > 0 then
- validWeaps[2] = 1
- end if
- if specialPlayerStats[3] > 0 then
- validWeaps[3] = 1
- end if
- if specialPlayerStats[4] > 0 then
- validWeaps[4] = 1
- end if
- if specialPlayerStats[5] = 0 then
- validWeaps[5] = 1
- end if
- if literalInputString[7] = 1 then
- if hitFirstTime = 0 then
- hitFirstTime = 1
- fineWithMe = 0
- repeat while fineWithMe = 0
- playerSelectedWeapon = playerSelectedWeapon + 1
- if playerSelectedWeapon > 5 then
- playerSelectedWeapon = 1
- end if
- fineWithMe = validWeaps[playerSelectedWeapon]
- end repeat
- set the member of sprite 787 to "WBG 1"
- set the member of sprite 789 to "WBG 1"
- set the member of sprite 792 to "WBG 1"
- set the member of sprite 795 to "WBG 1"
- set the member of sprite 798 to "WBG 1"
- set the member of sprite [787, 789, 792, 795, 798][playerSelectedWeapon] to "WBG 2"
- else
- end if
- else
- hitFirstTime = 0
- end if
- end if
- if shipDataBit_Status[2] > 0 then
- shipDataBit_Status[2] = shipDataBit_Status[2] - 1
- end if
- if literalInputString[5] = 1 then
- if shipDataBit_Status[2] <= 0 then
- weaponBit = shipReferenceIndex
- wingGunAim = shipDataBit_Loc[3]
- gSpread = weaponRef[2]
- if shipDataBit_Status[5] = 1 then
- locY = integer(cos((wingGunAim + 90) * PI / 180) * -gSpread)
- locX = integer(sin((wingGunAim + 90) * PI / 180) * gSpread)
- shipDataBit_Status[5] = 0
- else
- locY = integer(cos((wingGunAim - 90) * PI / 180) * -gSpread)
- locX = integer(sin((wingGunAim - 90) * PI / 180) * gSpread)
- shipDataBit_Status[5] = 1
- end if
- closestTarget = 0
- closestDistance = 9000
- selfGov = shipData[wShip][3]
- repeat with wShipScan = 1 to count(shipData)
- if shipData[wShipScan][1] = 1 then
- if selfGov <> shipData[wShipScan][3] then
- shipLoc = shipData[wShipScan][4][1]
- TargetLoc = shipData[wShipScan][4][1]
- scanDistresult = findDistance(shipLoc, shipDataBit_Loc[1])
- if scanDistresult <= closestDistance then
- termination = 1
- closestTarget = wShipScan
- closestDistance = scanDistresult
- end if
- end if
- end if
- end repeat
- if wShip = 1 then
- outtaAmmo = 0
- bulletType = [weaponRef[1], 8, 9, 2, 10][playerSelectedWeapon]
- heatUp = [weaponRef[3], 16, 30, 2, 30][playerSelectedWeapon]
- case playerSelectedWeapon of
- 2:
- specialPlayerStats[2] = specialPlayerStats[2] - 1
- member("Ammo Display 1").text = string(specialPlayerStats[2])
- if specialPlayerStats[2] <= 0 then
- outtaAmmo = 1
- end if
- 3:
- specialPlayerStats[3] = specialPlayerStats[3] - 1
- member("Ammo Display 2").text = string(specialPlayerStats[3])
- if specialPlayerStats[3] <= 0 then
- outtaAmmo = 1
- end if
- 4:
- specialPlayerStats[4] = specialPlayerStats[4] - 1
- member("Ammo Display 3").text = string(specialPlayerStats[4])
- if specialPlayerStats[4] <= 0 then
- outtaAmmo = 1
- end if
- end case
- if outtaAmmo = 1 then
- set the member of sprite 787 to "WBG 2"
- set the member of sprite 789 to "WBG 1"
- set the member of sprite 792 to "WBG 1"
- set the member of sprite 795 to "WBG 1"
- set the member of sprite 798 to "WBG 1"
- playerSelectedWeapon = 1
- end if
- else
- bulletType = weaponRef[1]
- heatUp = weaponRef[3]
- end if
- addBullet(shipData[wShip][3], bulletType, shipDataBit_Loc[1] + point(locX, locY), shipDataBit_Loc[2], shipDataBit_Loc[3], closestTarget)
- shipDataBit_Status[2] = heatUp
- end if
- else
- end if
- end if
- if findDistance(shipDataBit_Loc[2], point(0, 0)) > shipTerminalVelocity then
- driftAngle = findAngle(shipDataBit_Loc[2], point(0, 0))
- locY = integer(cos(driftAngle * PI / 180) * shipTerminalVelocity)
- locX = integer(sin(driftAngle * PI / 180) * -shipTerminalVelocity)
- shipDataBit_Loc[2] = point(locX, locY)
- end if
- shipDataBit_Loc[1] = shipDataBit_Loc[1] + shipDataBit_Loc[2]
- shipDataBit_Loc[3] = shipDataBit_Loc[3] + shipDataBit_Loc[4]
- shipData[wShip][4] = shipDataBit_Loc
- shipData[wShip][5] = shipDataBit_Status
- if shipIsdead = 1 then
- repeat with wAim = 1 to 10
- driftAngle = wAim * 36
- driftPower = 25 + random(100)
- locY = integer(cos(driftAngle * PI / 180) * driftPower)
- locX = integer(sin(driftAngle * PI / 180) * -driftPower)
- addparticle(6, shipDataBit_Loc[1], shipDataBit_Loc[2] + point(locX, locY))
- end repeat
- if random(3) = 1 then
- addPowerup(random(4), shipDataBit_Loc[1], shipDataBit_Loc[2])
- end if
- addparticle(9, shipDataBit_Loc[1], shipDataBit_Loc[2])
- shipData[wShip][1] = 0
- set the loc of sprite wSprite to point(-50, -50)
- if shipTerminalVelocity = 0 then
- playSound("Base Explode SFX")
- else
- if wShip = 1 then
- playSound("player Explode SFX")
- else
- playSound("Enemy Explosion SFX")
- end if
- end if
- levelScore = levelScore + shipReferenceIndex[activeShipType][2][5]
- next repeat
- end if
- if shipData[wShip][2] = 6 then
- if launchShrike = 1 then
- set the member of sprite 787 to "WBG 2"
- set the member of sprite 789 to "WBG 1"
- set the member of sprite 792 to "WBG 1"
- set the member of sprite 795 to "WBG 1"
- set the member of sprite 798 to "WBG 1"
- playerSelectedWeapon = 1
- launchShrike = 0
- member("Mega Cannon Status").text = "Incoming!!!"
- addBullet(shipData[wShip][3], 7, shipDataBit_Loc[1], point(0, 0), 0, shrikeDestination)
- end if
- end if
- wSprite = shipSO + wShip
- if findDistance(playerViewPoint + point(2900, 2200), shipDataBit_Loc[1]) <= 3800 then
- if activeShipType = 1 then
- if literalInputString[4] = 1 then
- set the member of sprite wSprite to "Fighter " & string((searchAItimer mod 6) + 1)
- else
- set the member of sprite wSprite to "Fighter Idle"
- end if
- end if
- sphereState = shipReferenceIndex[activeShipType][2][3]
- if sphereState = 0 then
- sprite(wSprite).rotation = shipDataBit_Loc[3]
- else
- sprite(wSprite).rotation = 0
- end if
- set the loc of sprite wSprite to (shipDataBit_Loc[1] - playerViewPoint) / 10
- if wShip = 1 then
- set the height of sprite 783 to paramsRef[1] + specialPlayerStats[1]
- set the height of sprite 784 to paramsRef[1] - shipData[1][5][1] + specialPlayerStats[1]
- end if
- sprite(wSprite).visible = 1
- else
- sprite(wSprite).visible = 0
- end if
- add(activeList, 1)
- end if
- end repeat
- if totalActiveShips <> totalShipsRecord then
- totalShipsRecord = totalActiveShips
- end if
- end
-